class regexp{ str: string; check: string; op(str: string, check: string) { this.str = str; this.check = check; var count = 0; var count1: number=0; for (let i = 0; i < this.str.length; i++){ count = i; if (str[i] == check[0]) { for (let j = 1; j < this.check.length; j++){ ++count; if (this.str[count] == this.check[j]) count1++; } } } if (count1 + 1 == this.check.length) console.log("The checking string is an regular expession"); else console.log("The checking string is not an regular expession"); } } var s = new regexp(); s.op("sridhar", "ridh");